package com.dhj.service.impl;

import com.dhj.dao.ItemDao;
import com.dhj.pojo.Item;
import com.dhj.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @author DaHuaJia 
 * @Description ItemServiceImpl 类
 * @Date 2021-11-20 13:20:27
 */
@Service
public class ItemServiceImpl implements ItemService {

    @Autowired
    private ItemDao itemDao;


    @Override
    @Transactional
    public void saveItem(Item item) {
        itemDao.save(item);
    }

    @Override
    public List<Item> queryItemByItem(Item item) {
        // 声明查询条件
        Example<Item> example = Example.of(item);
        // 根据查询条件查询数据
        List<Item> list = itemDao.findAll(example);
        return list;
    }
    
}
